package com.thd.springboottest.shironostate.configuration;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.SubjectContext;
import org.apache.shiro.web.mgt.DefaultWebSubjectFactory;

/**
 * com.thd.springboottest.shironostate.cfg.MySubjectFactory
 *
 * @author: wanglei62
 * @DATE: 2022/7/28 10:51
 **/
public class MyShiroSubjectFactory extends DefaultWebSubjectFactory {
    /**
     * 重写此方法，禁止Subject创建session
     * @param context
     * @return
     */
    @Override
    public Subject createSubject(SubjectContext context) {
        context.setSessionCreationEnabled(false);
        return super.createSubject(context);
    }
}
